This is a multi-part message in MIME format.
--===============1809535640==
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0181_01CA0F2D.12FD1000"
Content-language: en-us
This is a multi-part message in MIME format.
------=_NextPart_000_0181_01CA0F2D.12FD1000
Content-Type: text/plain;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Win32::Job is indeed the module to use if you want to be sure you catch =
all child processes too. It requires Windows 2000 or later.
You'll need to show us some sample code and explain how it didn't work =
for you if you expect additional help with it.
=20
As for Win32::Process, you should be able to use kill(-9, $pid) at least =
with reasonably newish ActivePerl versions to kill $pid and
all its children.
=20
Cheers,
-Jan
=20
From: activeperl-bounces@listserv.ActiveState.com =
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of Aclhk =
Aclhk
Sent: Tuesday, July 28, 2009 2:17 AM
To: Bill Luebkert
Cc: activeperl@listserv.ActiveState.com
Subject: Re: fork and kill process
=20
if we use Win32::Process, we could not kill all associated child =
processes.
--- 2009Äê7ÔÂ28ÈÕ ÐÇÆÚ¶þ£¬Bill Luebkert =
µÀ=A9s
¼Ä¼þÈË: Bill Luebkert
Ö÷=EE}: Re: fork and kill process
ÊÕ¼þÈË: "Aclhk Aclhk"
¸±±¾(CC): activeperl@listserv.ActiveState.com
ÈÕÆÚ: =
2009Äê7ÔÂ28ÈÕ,ÐÇÆÚ¶þ,ÉÏÎç9:1 4
Aclhk Aclhk wrote:
> i am new to writing perl in windows. I would like to achieve the same=20
> result from the following code:
>=20
> $pid =3D fork();
> defined $pid or die "fork($pid)\n";
> if($pid == 0)
> {
> exec("dir");
> }
>=20
> sleep(10);
> kill("TERM" =3D> $pid);
>=20
> I would to spawn a process and kill it (including the child process) =
at=20
> later time.
>=20
> Pls advise what code should be in windows environment. someone =
suggested=20
> win32::job but i failed to write a success code.
Check out Win32::Process and see if it will do what you need.
=20
_____ =20
Yahoo!Ïã¸ÛÌṩ=BEWÉϰ²È«¹¥=C 2Ô£¬½=
ÌÄãÈçºÎ·À¹ ºÚ¿=CD! =
Á˽â¸ü¶à
------=_NextPart_000_0181_01CA0F2D.12FD1000
Content-Type: text/html;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable
charset=3Dgb2312">
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40">
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>Win32::Job is indeed the module to use if you want to be =
sure
you catch all child processes too. It requires Windows 2000 or
later. You'll need to show us some sample code and explain how it =
didn't
work for you if you expect additional help with =
it.
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>As for Win32::Process, you should be able to use kill(-9, =
$pid) at
least with reasonably newish ActivePerl versions to kill $pid and all =
its
children.
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>Cheers,
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>-Jan
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>
0in 4.0pt'>
0in 0in 0in'>
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"' >From:=
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"' >
activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of =
Aclhk
Aclhk
Sent: Tuesday, July 28, 2009 2:17 AM
To: Bill Luebkert
Cc: activeperl@listserv.ActiveState.com
Subject: Re: fork and kill process
cellpadding=3D0>
if we use Win32::Process, we could not kill all =
associated
child processes.
--- 2009Äê7
lang=3DZH-TW>ÔÂ28
lang=3DZH-TW>ÈÕ ÐÇÆÚ¶þ£¬Bill Luebkert =
<dbecoll@roadrunner.com>
µÀ=A9s
¼Ä¼þÈË: Bill Luebkert =
<dbecoll@roadrunner.com>
Ö÷=EE}: Re: fork and kill process
ÊÕ¼þÈË: "Aclhk Aclhk"
<aclhkaclhk@ymail.com>
¸±±¾(CC): =
activeperl@listserv.ActiveState.com
ÈÕÆÚ: 2009
lang=3DZH-TW>Äê7ÔÂ28
lang=3DZH-TW>ÈÕ,
lang=3DZH-TW>ÐÇÆÚ¶þ,
lang=3DZH-TW>ÉÏÎç9:14
Aclhk Aclhk wrote:
> i am new to writing perl in windows. I would like to achieve the =
same
> result from the following code:
>
> $pid =3D fork();
> defined $pid or die "fork($pid)\n";
> if($pid == 0)
> {
> exec("dir");
> }
>
> sleep(10);
> kill("TERM" =3D> $pid);
>
> I would to spawn a process and kill it (including the child =
process) at
> later time.
>
> Pls advise what code should be in windows environment. someone =
suggested
> win32::job but i failed to write a success code.
Check out Win32::Process and see if it will do what you =
need.
|
style=3D'font-size:10.0pt;font-family:"Calibri","sans-serif" '> =
style=3D'font-size:10.0pt;font-family:"Calibri","sans-serif" '>
style=3D'font-size:10.0pt;font-family:"Calibri","sans-serif" '>Yahoo!
n>
style=3D'font-size:10.0pt;font-family:"MS =
Mincho"'>Ïã¸ÛÌṩ=BEWÉϰ²È«=B9=A 5ÂÔ£¬=
½ÌÄãÈçºÎ·À¹ ºÚ¿Í
style=3D'font-size:10.0pt;font-family:"Calibri","sans-serif" '>!
href=3D"http://hk.promo.yahoo.com/security/">
style=3D'font-family:"MS =
Mincho"'>Á˽â¸ü¶à